
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Login Page</title>
    </head>
    <body>
        <script type="text/javascript">
	
            function onChangeLocale(lang) {
                var newURL = "";
                var questionMarkLocation = document.URL.indexOf("?");
                if (questionMarkLocation != -1) {
                    newURL = document.URL.substring(0, questionMarkLocation);
                } else {
                    newURL = document.URL;
                }

                newURL = newURL + "?locale=" + lang;

                document.location = newURL;
            }
        </script>

        <form:form method="POST" action="login" commandName="login">        
            <table>
                <tr>
                    <td><spring:message code="login_username" />
                    </td>
                    <td><form:input id="username"
                                path="username" />
                    </td>
                </tr>
                <tr>
                    <td><spring:message code="login_pass" />
                    </td>
                    <td><form:input id="pass"
                                path="pass" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2"><form:errors path="username" />
                    </td>
                </tr>
                <tr>
                    <td><input type="submit"
                               value="<spring:message code="login_btn"/>" name="login"/>
                    </td></tr>
            </table>
        </form:form>
    </body>
</html>
